<template>
  <el-table :data="tableData" stripe style="width: 100%">
    <el-table-column prop="orderId" label="订单号" width="120" />
    <el-table-column prop="product[0].productName" label="商品名称" width="120" />
    <el-table-column prop="count" label="数量" width="120" />
    <el-table-column prop="totalPrice" label="总价格" width="120" />
    <el-table-column prop="payMode.name" label="支付方式" width="120" />
    <el-table-column prop="orderTime" label="时间"/>
  </el-table>
</template>
<script>
import { ref } from 'vue'
import axios from 'axios'
export default {
  name: 'HistoryList',
  setup () {
    const tableData = ref([])
    // const arr = [
    //   {
    //     id: 1,
    //     name: '挖掘机',
    //     count: 1,
    //     price: 6666,
    //     paymode: '微信支付',
    //     date: '2023-01-05 08:24'
    //   },
    //   {
    //     id: 1,
    //     name: '挖掘机',
    //     count: 1,
    //     price: 6666,
    //     paymode: '微信支付',
    //     date: '2023-01-05 08:24'
    //   },
    //   {
    //     id: 1,
    //     name: '挖掘机',
    //     count: 1,
    //     price: 6666,
    //     paymode: '微信支付',
    //     date: '2023-01-05 08:24'
    //   }
    // ]
    // tableData.value = arr
    const getListData = async () => {
      const result = await axios.get('http://localhost:8080/api/order/list?customerid=1')
      console.log(result.data.data)
      tableData.value = result.data.data
    }
    getListData()
    return {
      tableData
    }
  }
}
</script>
